
package carmadness.view;

import java.awt.Color;

import carmadness.model.TrafficLight;

/**
 * Közlekedési lámpát grafikus felületen megjelenítő osztály.
 * 
 * @author arpi
 * @version 1.0
 * @created 10-Apr-2010 2:32:40 PM
 */
public class GraphicTrafficLightRenderer extends GraphicRenderer
{
	/**
	 * A renderelést végző metódus.
	 * 
	 * @param object
	 */
	public void render( Object object )
	{
		TrafficLight light = (TrafficLight)object;

		graphics.setColor( new Color( 30, 30, 30 ) );
		graphics.fillRect( 6, 2, 16, 22 );
		graphics.setColor( Color.BLACK );
		graphics.drawRect( 5, 2, 15, 21 );

		if ( light.isGreen() )
		{
			graphics.setColor( new Color( 100, 10, 10 ) );
			graphics.fillArc( 8, 3, 9, 9, 0, 360 );

			graphics.setColor( Color.GREEN );
			graphics.fillArc( 8, 13, 9, 9, 0, 360 );
		}
		else
		{
			graphics.setColor( Color.RED );
			graphics.fillArc( 8, 3, 9, 9, 0, 360 );

			graphics.setColor( new Color( 10, 100, 10 ) );
			graphics.fillArc( 8, 13, 9, 9, 0, 360 );

		}
	}
}
